<?php
/**
 * Controller for all help pages
 * @author DatNgo <nhdat.itec@gmai.com>
 * @create_at   29 Jun, 2013
 * @updated     <name>
 * @updated_at  <time>
 */
class HelpController extends Controller
{

    public function actionIndex()
    {
        $this->redirect(array('site/index'));
    }

    public function actionPlay()
    {
        $game = !empty($_GET['game']) ? $_GET['game'] : null;
        // TODO load from db
        if (in_array($game, array('xito', 'tienlen', 'phom', '3la', 'covua', 'cotuong'))) {
            $help = Page::getHelp('play.'.$game);
            if(is_object($help)){
                $this->render('play', array('model'=>$help));
                return true;
            }
        }
        $this->redirect(array('site/index'));
    }

}